package com.muyu.danmo.service.impl;


import com.muyu.common.core.domain.Result;
import com.muyu.danmo.domain.DanmoArtDepartment;
import com.muyu.danmo.mapper.DanmoArtDepartmentMapper;
import com.muyu.danmo.service.IDanmoArtDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 院系类型Service业务层处理
 * 
 * @author yangle
 * @date 2024-12-20
 */
@Service
public class DanmoArtDepartmentServiceImpl implements IDanmoArtDepartmentService
{
    @Autowired
    private DanmoArtDepartmentMapper danmoArtDepartmentMapper;

    /**
     * 查询院系类型
     * 
     * @param id 院系类型主键
     * @return 院系类型
     */
    @Override
    public DanmoArtDepartment selectDanmoArtDepartmentById(Long id)
    {
        return danmoArtDepartmentMapper.selectDanmoArtDepartmentById(id);
    }

    /**
     * 查询院系类型列表
     *
     * @param danmoArtDepartment 院系类型
     * @return 院系类型
     */
    @Override
    public List<DanmoArtDepartment> selectDanmoArtDepartmentList(DanmoArtDepartment danmoArtDepartment)
    {
        return danmoArtDepartmentMapper.selectDanmoArtDepartmentList(danmoArtDepartment);
    }

    /**
     * 新增院系类型
     *
     * @param danmoArtDepartment 院系类型
     * @return 结果
     */
    @Override
    public Result insertDanmoArtDepartment(DanmoArtDepartment danmoArtDepartment)
    {
       try {
           int i = danmoArtDepartmentMapper.insertDanmoArtDepartment(danmoArtDepartment);
           return Result.success(i,"添加成功");
       }catch (Exception e){
           return Result.error("添加失败");
       }
    }

    /**
     * 修改院系类型
     * 
     * @param danmoArtDepartment 院系类型
     * @return 结果
     */
    @Override
    public int updateDanmoArtDepartment(DanmoArtDepartment danmoArtDepartment)
    {
        return danmoArtDepartmentMapper.updateDanmoArtDepartment(danmoArtDepartment);
    }

    /**
     * 批量删除院系类型
     * 
     * @param ids 需要删除的院系类型主键
     * @return 结果
     */
    @Override
    public int deleteDanmoArtDepartmentByIds(Long[] ids)
    {
        return danmoArtDepartmentMapper.deleteDanmoArtDepartmentByIds(ids);
    }

    /**
     * 删除院系类型信息
     * 
     * @param id 院系类型主键
     * @return 结果
     */
    @Override
    public int deleteDanmoArtDepartmentById(Long id)
    {
        return danmoArtDepartmentMapper.deleteDanmoArtDepartmentById(id);
    }
}
